<?php


namespace Biz\service\redPacket;

use Biz\model\redPacket\RedPacketsLog as mRedPacketsLog;


class RedPacketsLog
{
    /**
     * 获取订单红包金额
     * @param array $where
     * @return array
     */
    public static function getInfo($orderNo){
        $data = [];
        $data = mRedPacketsLog::get(
            'packet_amount',
            ['order_no'=>$orderNo,'type'=>mRedPacketsLog::TYPE_PAY]
        );

        return $data;
    }

    /**
     * 批量获取订单红包详情
     * @param array $where
     * @return array
     */
    public static function getList($orderNo){
        $data = [];
        $data = mRedPacketsLog::select(
            ['order_no', 'packet_amount'],
            ['order_no'=>$orderNo,'type'=>mRedPacketsLog::TYPE_PAY]
        );
        if(!empty($data)) {
            $data = array_column($data, NULL, 'order_no');
        }

        return $data;
    }



}